﻿using Interview.Model.Enum;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Interview.Model
{
    /// <summary>
    /// 奶茶店
    /// </summary>
    public class MilkTeaShop
    {
        private Queue<Order> orderQueue = new Queue<Order>();
        private int nextOrderNumber = 1;

        // 创建奶茶
        public MilkTea CreateMilkTea(CupgradeEnum cupgrade)
        {
            return new MilkTea(cupgrade);
        }

        // 下订单
        public int PlaceOrder(MilkTea milkTea)
        {
            Order order = new Order(nextOrderNumber++, milkTea);
            orderQueue.Enqueue(order);
            Console.WriteLine($"订单 #{order.OrderNumber} 已加入队列");
            return order.OrderNumber;
        }

        // 处理下一个订单
        public Order ProcessOrder()
        {
            if (orderQueue.Count == 0)
            {
                Console.WriteLine("没有待处理的订单");
                return null;
            }

            Order order = orderQueue.Dequeue();
            Console.WriteLine($"正在处理订单 #{order.OrderNumber}: {order.MilkTea}");
            return order;
        }



        // 获取队列中的订单数量
        public int GetQueueLengthNum()
        {
            return orderQueue.Count;
        }
    }
}
